package com.example.controller.wechat;

import com.example.pojo.web.Result;
import com.example.pojo.wechat.WxCity;
import com.example.service.wechat.WxCityService;
import com.example.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @ClassName WxCityController
 * @Description: com.example.controller.wechat
 * @Auther: xiwd
 * @Date: 2022/4/16 - 04 - 16 - 21:48
 * @version: 1.0
 */
@Controller
@RequestMapping("/wxcity")
public class WxCityController {
    //properties
    @Autowired
    private WxCityService wxCityService;

    //methods
    /**
     * 查询所有的City及其包含的Stop停车区
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/get/all/stops")
    public Result selectAllCityWithStops(){
        try {
            List<WxCity> wxCities = wxCityService.selectAllCityWithStops();
            return ResultUtil.success(1,"查询成功",wxCities);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.error(0,"查询失败");
        }
    }
}
